package com.wanmait.schedule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.schedule.entity.Log;
import com.wanmait.schedule.entity.Student;
import com.wanmait.schedule.entity.Teacher;
import com.wanmait.schedule.mapper.LogMapper;
import com.wanmait.schedule.service.LogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 操作日志表 服务实现类
 * </p>
 *
 * @author wanmait
 * @since 2022-12-05
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements LogService {
    @Resource
    private  LogMapper logMapper;
    @Override
    public PageInfo<Log> list(Log log, Integer pageNum) {
        if(pageNum==null) {
            pageNum = 1;
        }
           PageHelper.startPage(pageNum,6);
//            LambdaQueryWrapper<Log> queryWrapper = new LambdaQueryWrapper<>();
//            queryWrapper.eq(log.getTeacherId()!=null,Log::getTeacherId,log.getTeacherId());
//            queryWrapper.eq(log.getStudentId()!=null,Log::getStudentId,log.getStudentId());
//            queryWrapper.eq(log.getInputTime()!=null,Log::getInputTime,log.getInputTime());
//            queryWrapper.like(StringUtils.isNotBlank(log.getInfo()),Log::getInfo,log.getInfo());
//            queryWrapper.like(StringUtils.isNotBlank(log.getIp()),Log::getIp,log.getId());
            List<Log> logs = logMapper.list();
            PageInfo<Log> pageInfo = new PageInfo<>(logs,10);
            return pageInfo;
        }


}
